<template>
  <div class="app-container">
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span>单条邮件发送日志详情</span>
      </div>
      <div>
        <div style="height: 350px;overflow-y: auto;overflow-x: hidden;">
          <div class="infoList">
            <span>邮件主题: </span>
            <div class="contentSize">{{infoData.emailSubject}}</div>
          </div>
          <div class="infoList">
            <span style="margin-top: 6px;">邮件接收人邮箱所有: </span>
            <div class="contentSize">
              <el-tag :key="'sjrEmail' + index" v-if="emailArrToall.length > 0" v-for="(item, index) in emailArrToall" class="tabAll">{{item}}</el-tag>
            </div>
          </div>
          <div class="infoList">
            <span style="margin-top: 6px;">邮件抄送人邮箱所有: </span>
            <div class="contentSize">
              <el-tag :key="'csEmail' + index" v-if="emailArrCcall.length > 0" v-for="(item, index) in emailArrCcall" class="tabAll">{{item}}</el-tag>
            </div>
          </div>
          <div class="infoList">
            <span>邮件内容: </span>
            <div class="contentSize">
              <el-input
                type="textarea"
                disabled
                :rows="5"
                placeholder="请输入内容"
                v-model="infoData.emailContent">
              </el-input>
            </div>
          </div>
          <div class="infoList">
            <span>发送时间: </span>
            <div class="contentSize">{{infoData.sendTime}}</div>
          </div>
          <div class="infoList">
            <span>是否成功: </span>
            <div class="contentSize">{{infoData.sendFlag | loginSuccess}}</div>
          </div>
          <div class="infoList">
            <span>发送提示信息: </span>
            <div class="contentSize">{{infoData.sendMsg}}</div>
          </div>
        </div>
        <div style="margin-top: 15px;">
          <el-row :gutter="5">
            <el-col style="text-align: right;">
              <el-button class="filter-item" type="primary" @click="closeSelf">关 闭</el-button>
            </el-col>
          </el-row>
        </div>
      </div>
    </el-card>
  </div>
</template>

<script>
export default {
  name: 'changePassword',
  data() {
    return {
      options: [],
      formData: {},
      infoData: {},
      emailArrCcall: [],
      emailArrToall: [],
      politicsList: {
        condition: [
          {
            property: 'id',
            value: '',
            type: 'EQ'
          }
        ]
      },
      postlist: {
        userId: ''
      }
    }
  },
  mounted() {
    this.fetchData()
    console.log(this.$store.state.emailNum)
  },
  filters: {
    loginSuccess: function(value) {
      if (value == 0) {
        return '否'
      } else {
        return '是'
      }
    }
  },
  methods: {
    fetchData() {
      this.politicsList.condition[0].value = this.$route.query.id
      this.$store
        .dispatch('MailMessage', this.politicsList)
        .then(res => {
          this.infoData = res.data.records[0]
          if (res.data.records[0].emailCcAll != '') {
            this.emailArrCcall = res.data.records[0].emailCcAll.split(',')
          }
          if (res.data.records[0].emailToAll != '') {
            this.emailArrToall = res.data.records[0].emailToAll.split(',')
          }
        })
        .catch(() => {

        })
    },
    fcTimeTime() {

    },
    lmTimeTime() {

    },
    closeSelf() {
      this.$router.push({ name: 'mailMessage' })
    },
    saveData() {
      this.formData = this.ruleForm
      if (this.formData.name) {
        this.$store
          .dispatch('AddressBookInformationCr', this.formData)
          .then(res => {
            this.$message({
              message: '添加成功',
              type: 'success'
            })
            this.$router.push({ name: 'addressBookInformation' })
          })
          .catch(() => {

          })
      } else {
        this.$message({
          message: '请填写姓名',
          type: 'error'
        })
      }
    },
    birthdayTime(val) {
      // this.ruleForm.birthday = val + '000000'
    },
    workDateTime(val) {
      // this.ruleForm.workDate = val + '000000'
    },
    employedDateTime(val) {
      // this.ruleForm.employedDate = val + '000000'
    }
  }
}
</script>

<style scoped>
  .infoList span{
    display: inline-block;
    vertical-align: middle;
  }
  .infoList .contentSize{
    display: inline-block;
    vertical-align: middle;
    word-wrap: break-word;
    width: 70%;
    margin-left: 15px;
  }
  .infoList {
    margin: 30px 0;
  }
  .tabAll{
    margin-left: 16px;
    margin-top: 6px;
  }
</style>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>
